<template>
	<view :data-theme="theme">
		<view class="ChangePassword">
			<view class="list">
				<view class="item" >
					<input type='text' placeholder='请填写贝视优账号' placeholder-class='placeholder' v-model="userName"></input>
				</view>
				<view class="item" >
					<input type='text' placeholder='请填写贝视优密码' placeholder-class='placeholder' v-model="password"></input>
				</view>
			</view>
			<button form-type="submit" class="confirmBnt bg_color"  @click="save">保存</button>
		</view>
	</view>
</template>

<script>
	import sendVerifyCode from "@/mixins/SendVerifyCode";
	import {
		bindingBsyAccount,
	} from '@/api/user.js';
	import {toLogin} from '@/libs/login.js';
	import {mapGetters} from "vuex";
	import {setThemeColor} from '@/utils/setTheme.js'
	const app = getApp();
	export default {
		data() {
			return {
				userName:'',
				password:'',
				isShowAuth: false, //是否隐藏授权
				theme:app.globalData.theme,
				bgColor:''
			};
		},
		mounted() {
		      // this.timer = setInterval(this.getTimes, 1000);
		},
		computed: mapGetters(['userInfo']),
		onLoad() {
			let that = this;
			that.bgColor = setThemeColor();
			uni.setNavigationBarColor({
				frontColor: '#ffffff',
				backgroundColor:that.bgColor,
			});
		},
		methods: {
			onLoadFun:function(){},
			// 授权关闭
			authColse: function(e) {
				this.isShowAuth = e
			},
			
			//提交
			save: function() {
				let that = this;
				uni.showModal({
					title: '是否确认绑定贝视优账号',
					confirmText: '绑定',
					success(res) {
						if (res.confirm) {
							bindingBsyAccount({
								userName: that.userName,
								password: that.password
							}).then(res => {
								
								that.$store.commit("changInfo", {
									amount1: 'avatar',
									amount2: that.newAvatar
								});
								return that.$util.Tips({
									title: res.message,
									icon: 'success'
								}, {
									tab: 4,
									url: '/pages/user/index'
								});
							}).catch(err => {
								return that.$util.Tips({
									title: err
								});
							})
						}
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.shading {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		
		/* #ifdef APP-VUE */
		margin-top: 50rpx;
		/* #endif */
		/* #ifndef APP-VUE */
		
		margin-top: 200rpx;
		/* #endif */
		
		
		image {
			width: 180rpx;
			height: 180rpx;
		}
	}
	page {
		background-color: #fff !important;
	}
	.ChangePassword{padding-top:100rpx;}
	.ChangePassword .phone {
		font-size: 32rpx;
		font-weight: bold;
		text-align: center;
		margin-top: 55rpx;
	}

	.ChangePassword .list {
		width: 580rpx;
		margin: 0 auto;
	}

	.ChangePassword .list .item {
		width: 100%;
		height: 110rpx;
		border-bottom: 2rpx solid #f0f0f0;
	}

	.ChangePassword .list .item input {
		width: 100%;
		height: 100%;
		font-size: 32rpx;
	}

	.ChangePassword .list .item .placeholder {
		color: #b9b9bc;
	}

	.ChangePassword .list .item input.codeIput {
		width: 340rpx;
	}

	.ChangePassword .list .item .code {
		font-size: 32rpx;
		@include main_color(theme);
		background-color: #f5f5f5;
	}

	.ChangePassword .list .item .code.on {
		color: #b9b9bc !important;
	}

	.ChangePassword .confirmBnt {
		font-size: 32rpx;
		width: 580rpx;
		height: 90rpx;
		border-radius: 45rpx;
		color: #fff;
		margin: 92rpx auto 0 auto;
		text-align: center;
		line-height: 90rpx;
	}
	.bg_color{
		@include main_bg_color(theme);
	}
</style>
